//860. 柠檬水找零

#include <stdbool.h>
bool lemonadeChange(int* bills, int billsSize){
    int five = 0, ten = 0;
    for(int i = 0; i < billsSize; i++)
    {
        if(bills[i] == 5)
        {
            five++;
        }
        else if(bills[i] == 10)
        {
            if(five == 0)
            {
                return false;
            }
            five--;
        }
        else
        {
            if(five > 0 && ten > 0)
            {
                five--;
                ten--;
            }
            else if(five >= 3)
            {
                five -= 3;
            }
            else
            {
                return false;
            }
        }
    }
    return true;
}